home *** CD-ROM | disk | FTP | other *** search
/ Scene Storm / Scene Storm - Volume 1.iso / coding / c / memleak_1.0 / memleak.doc < prev    next >
Text File  |  1995-11-05  |  2KB  |  40 lines

  1.  
  2. MemLeak 1.0 -- A tool to aid discovery of memory leaks in programs.
  3.  
  4. ©1994 by Francesco Devitt
  5.  
  6. email: ffranc@comp.vuw.ac.nz
  7. smail: 29a Kinghorne St, Strathmore, Wellington, New Zealand.
  8.  
  9. Often when nearing the completion of a programming effort it becomes
  10. necessary to test whether one's program contains any memory leaks.
  11. The typical way this is done is to open a shell, ensuring that all
  12. review and history buffers are off and execute "AvailMem TOTAL FLUSH"
  13. before and after the program has run.
  14.  
  15. The FLUSH keyword is needed so that any shared libraries and other resources
  16. that the program required are removed. It may also be necessary to call
  17. AvailMem several times before the figure returned settles.
  18.  
  19. Now came the difficult part, actually performing the subtraction; memory
  20. loss equals before minus after, etc.
  21.  
  22. MemLeak provides a simple way of achieving all this. All that needs to
  23. be done is to click on the "Before" button, run the program, then
  24. click the "After" button. The amount of memory before and after is
  25. displayed along with a difference.
  26.  
  27. The memory size is calculated by continually attempting to allocate
  28. all the system's memory (which will flush libraries) and the requesting the
  29. avaiable memory. This is done until the same value is returned a number of
  30. times. The whole process takes about one second.
  31.  
  32. MemLeak's GUI was designed with GadToolsBox, and the whole program took
  33. half an hour to write including this documentation. Full SAS/C source code
  34. and the gadtools source file are included.
  35.  
  36. MemLeak runs either from a shell or the workbench. There are no options
  37. or tooltypes that need to be set.
  38.  
  39. Share and Enjoy.
  40.